package com.rocky.study.generic;

import java.util.Iterator;
import java.util.Random;

public class GenericDemo2 {
    public static void main(String[] args) {
        DynamicArray<Double> dynamicArray = new DynamicArray<>();
        Random random = new Random();
        int size = 1 + random.nextInt(100);
        for (int i = 0; i < size; i++) {
            dynamicArray.add(Math.random());
        }
        Double number = dynamicArray.get(random.nextInt(size));
        System.out.println("获取指定位置" + random.nextInt(size) +"的元素值" + number);

        for (int i = 0; i < size; i++) {
            System.out.println("第 " + i + "个位置的随机值:" + dynamicArray.get(i));
        }
    }
}
